package types;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class MPic extends MObject{
	
	public static MPic newInstance() throws IOException{
		return new MPic();
	}

	public MPic(){
		super.type = types.MType.PICTYPE;
		} //modify
	
	public MPic(MObject o, double s, double w, double h, double r, int z, int t, String p) throws IOException
	{
		super(o,s,w,h,r,z,t);
		path = p;
		image = ImageIO.read(new File(path));
		super.type = types.MType.PICTYPE;
	}
	public void setPath(String p)
	{
		path = p;
	}
	public String getPath()
	{
		return path;
	}
	public void setImage( ) throws IOException{
		image = ImageIO.read(new File(path));
		super.width = image.getWidth(null);
		super.height = image.getHeight(null);
	}
	public Image getImage(){
		return image;
	}
	
	
	public String path = ""; //picture will be loaded in the CalcCoordinates method of Mat.
	public Image image;
}
